﻿using System;

namespace  Might.Infrastructure.DOM {

    /// <summary>
    /// Attibute for the definition of possible children groups of DOM nodes.
    /// Allows also specify restriction on the type of children in the group.
    /// Type restriction can be ommitted.
    /// </summary>
    [AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
    public class ContainedChildAttribute : Attribute {
        
        /// <summary>
        /// Name of the children group that will be allowed in a decorated class/interface
        /// </summary>
        public string ChildrenGroupName { get; set; }

        /// <summary>
        /// Type of the children in a group that will be allowed in a decorated class/interface
        /// </summary>
        public Type ChildrenGroupNameType { get; set; }

        public ContainedChildAttribute(string childrenGroupName) {
            ChildrenGroupName = childrenGroupName;
            ChildrenGroupNameType = null;
        }

        public ContainedChildAttribute(string childrenGroupName, Type childrenGroupNameType) {
            ChildrenGroupName = childrenGroupName;
            ChildrenGroupNameType = childrenGroupNameType;
        }
    }

    /// <summary>
    /// Attibute for the definition of possible reference groups of DOM nodes.
    /// Allows also specify restriction on the type of references in the group.
    /// Type restriction can be ommitted.
    /// </summary>
    [AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
    public class ContainedReferenceAttribute : Attribute {
        
        /// <summary>
        /// Name of the reference group that will be allowed in a decorated class/interface
        /// </summary>
        public string ReferenceName { get; set; }
        
        /// <summary>
        /// Type of the referenced node in a group that will be allowed in a decorated class/interface
        /// </summary>
        public Type ReferenceNameType { get; set; }

        public ContainedReferenceAttribute(string childrenGroupName) {
            ReferenceName = childrenGroupName;
            ReferenceNameType = null;
        }

        public ContainedReferenceAttribute(string childrenGroupName, Type childrenGroupNameType) {
            ReferenceName = childrenGroupName;
            ReferenceNameType = childrenGroupNameType;
        }
    }


    
}